import { defineStore } from 'pinia'

export const useTokenStore = defineStore('token', {
  state: () => ({
    token: '',
  }),

  actions: {
    getToken() {
      this.token = sessionStorage.getItem('token') || ''
      return this.token
    },
    setToken(token: string) {
      sessionStorage.setItem('token', token)
      this.token = token
    },
    removeToken() {
      sessionStorage.removeItem('token')
      this.token = ''
    },
  },
})
